{include file="Public:header" /}
		<div class="bar bar-nav">
			<h1 class="title">活动详情
                            <!--{$activity['activity_name']}-->
                        </h1>
			<i class="icon icon-left" onclick="window.history.go(-1);"></i>
		</div>
		<div class="content">
			<div class="row activity_banner">
				<div class="col-100">
					<img src="{$activity['activity_img']}">
				</div>
				<div class="col-100 activity_top_title">
					<div class="content-padded">
						<h3>{$activity['activity_name']}</h3>
						<p>
							<span><i class="iconfont icon-huiyuan1"></i>[ {$activity['sponsor']} ]</span>
							<span class="pull-right"><i class="iconfont icon-browse"></i>{$activity['browse_number']}</span>
							<span class="pull-right"><i class="iconfont icon-fenxiang"></i>{$activity['share_number']}</span>
						</p>
					</div>
				</div>
			</div>

			<div class="row activity_list">
				<div class="col-100">
					<div class="list-block">
						<ul>
							<li class="item-content">
								<div class="item-media"><i class="iconfont icon-history"></i></div>
								<div class="item-inner">
									<div class="item-title">{$activity['start_time']|date="Y-m-d H:i",###} 至 {$activity['end_time']|date="Y-m-d H:i",###}</div>
								</div>
							</li>
							<li class="item-content">
								<div class="item-media"><i class="iconfont icon-map"></i></div>
								<div class="item-inner">
									<div class="item-title">{$activity['detail_address']}</div>
								</div>
							</li>
							<li class="item-content">
								<div class="item-media"><i class="iconfont icon-account"></i></div>
								<div class="item-inner">
									<div class="item-title">已报名{$activity['signup_number']|default="0"}人</div>
								</div>
							</li>
							<li class="item-content">
								<div class="item-media"><i class="iconfont icon-demo22"></i></div>
								<div class="item-inner">
									<div class="item-title">
										<font class="button-danger">{$activity['price']}/人</font>
									</div>
								</div>
							</li>
							<li class="item-content">
								<div class="item-media"><i class="iconfont icon-phone"></i></div>
								<div class="item-inner">
									<div class="item-title">{$activity['contact_mobile']} <a class="button" href="tel:{$activity['contact_mobile']}" style="display:inline-block;">拨打</a></div>
								</div>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<div class="row activity_txt">
				<div class="col-100">
					<div class="content-padded" style="max-height:60px;">
						{$activity['describe']|htmlspecialchars_decode}
					</div>
					<div class="activity_btn text-center">
						<span>展开更多详情<i class="iconfont icon-moreunfold"></i></span>
					</div>
				</div>
			</div>
			<div class="row sign">
				<div class="col-100">
					<div class="content-padded">
						<div class="sign_title content-block-title">已报名（{$person_count}）<a href="{:U('moreSignUp', array('activity_id'=>$activity_id))}"><span class="pull-right">更多报名<i class="icon icon-right"></i></span></a></div>
						<div class="list-block" style="margin:0;">
							{if condition="$person_count > 0"}
							<ul>
							{foreach name="sign" item="sign" key="k"}
								<li><img src="{$sign['headimgurl']}">
									<p>{$sign['nickname']}</p>
								</li>
							{/foreach}
							</ul>
							{else/}
							<ul>
							 <li style="width: 100%;"><p style="font-size:12px;text-align:center;color:#999;padding-top:10px;">暂时没有人报名</p></li>
							</ul>
							{/if}
							
						</div>
					</div>
				</div>
			</div>
			<div class="row discuss">
				<div class="col-100">
					<div class="content-padded">
						<div class="sign_title content-block-title">讨论（{$discuss_count}）<a href="javascript:void(0);" onclick="discuss_form(0,0)" class="discuss_form" ><span class="pull-right">我要讨论</span></a></div>
						<div class="list-block media-list">
							{if condition="$discuss[0]['id']"}
							<ul id="discuss_ul">
							{foreach name="discuss" item="discuss" key="k"}
								<li class="item-content img_top">
									<div class="item-media div_block">
										<img src="{$discuss['head_img']}">
									</div>
									<div class="item-inner" onclick="discuss_form({$discuss['user_id']},'{$discuss['nickname']}')">
										<div class="item-title-row">
											<div class="item-title">{$discuss['nickname']}<span class="pull-right">{$discuss['add_time']|date="Y-m-d",###}</span></div>
										</div>
										{if condition="$discuss['reply_user_id']"}
										<div class="item-title" style="line-height:20px;text-indent: 1em;color: #999;">回复&nbsp; {$discuss['reply_nickname']}：</div>
										{/if}
										<div class="item-subtitle">{$discuss['content']}</div>
									</div>
								</li>
							{/foreach}
							</ul>
							<div class="discuss_move text-center"><a href="{:U('Discuss',array('activity_id'=>$activity_id, 'display'=>1))}">更多评论</a></div>
							{else/}
							<ul>
							 <li><p style="font-size:12px;text-align:center;color:#999;padding-top:10px;">暂时没有人讨论</p></li>
							</ul>
							{/if}
							
						</div>
					</div>
				</div>
			</div>
			<div class="row recommend">
				<div class="col-100">
					<div class="content-padded">
						<div class="sign_title content-block-title">为你推荐<a href="/ActivityCategory/index"><span class="pull-right">查看更多<i class="icon icon-right"></i></span></a></div>
					</div>
				</div>
			</div>
			<div class="row recommend" style="background: none;margin-top:0;">
				<div class="col-100">
					<div class="content-padded">
						<div class="list-block clearfix">
							<ul>
							{foreach name="reco" item="reco" key="k"}
								<li>
									<!-- <a href="{:U('index', array('activity_id'=>$reco['id'], 'city'=>$city))}"> -->
									<a href="/ActivityDetail/index?activity_id={$reco['id']}&city={$city}">
										<img src="{$reco['activity_img']}">
										<h3 class="item-title">{$reco['activity_name']}</h3>
										<p class="item-title">{$activity['start_time']|date="Y-m-d",###} 至 {$activity['end_time']|date="Y-m-d",###}</p>
										<p class="item-title">{$reco['area']}</p>
										<span>￥{$reco['price']}</span>
									</a>
								</li>
						    {/foreach}
							</ul>
						</div>
					</div>
				</div>
			</div>
			
</div>

<div class="activity_from_bg discuss_1 discuss_close" style="display: none;"></div>
			<div class="activity_from discuss_1" style="display: none;">
				
				<form action="{:U('Wxpay/addOrder')}" method="post" id="info_form">
					<span class="close discuss_close"><i class="iconfont icon-add"></i></span>
					<div class="list-block">
						<div class="item-title text-center">填写报名</div>
    <ul>
      <!-- Text inputs -->
      <li>
        <div class="item-content">
          <div class="item-media"><i class="icon icon-form-name"></i></div>
          <div class="item-inner">
            <div class="item-title label">姓名</div>
            <div class="item-input">
              <input type="text" name="name" placeholder="姓名">
            </div>
          </div>
        </div>
      </li>
      <li>
        <div class="item-content">
          <div class="item-media"><i class="icon icon-form-name"></i></div>
          <div class="item-inner">
            <div class="item-title label">手机</div>
            <div class="item-input">
              <input type="text" name="mobile" placeholder="手机">
            </div>
          </div>
        </div>
      </li>
      <li>
        <div class="item-content">
          <div class="item-media"><i class="icon icon-form-name"></i></div>
          <div class="item-inner">
            <div class="item-title label">邮箱</div>
            <div class="item-input">
              <input type="text" name="email" placeholder="邮箱">
            </div>
          </div>
        </div>
      </li>
<!--       <li>
        <div class="item-content">
          <div class="item-media"><i class="icon icon-form-name"></i></div>
          <div class="item-inner">
            <div class="item-title label">数量</div>
            <div class="item-input">
              <input type="number" name="number" placeholder="1">
            </div>
          </div>
        </div>
      </li> -->
    </ul>
  </div>
  <div class="content-block">
    <div class="row">
      <input type="hidden" name="activity_id" value="{$activity['id']}" />
      <div class="col-50"><span>合计：<font class="button-danger">￥{$activity['price']}</font></span></div>
      <div class="col-50"><button style="width:100%;" type="submit" class="button button-big button-fill button-success">提交</button></div>
    </div>
  </div>
				</form>
			</div>
<nav class="bar activity_nav bar-tab">
			{if condition="$collect"}
			<a class="tab-item js-sc active">
				<span class="iconfont icon-favorite"></span>
				<span class="tab-label">已关注</span>
			</a>
			{else/}
			<a id="follow"  class="tab-item js-sc">  <!-- onclick="follow(this)" -->
				<span class="iconfont icon-favorite"></span>
				<span class="tab-label">我要关注</span>
			</a>
			{/if}
			<a class="tab-item on js-bm">
				<span class="iconfont icon-account"></span>
				<span class="tab-label">我要报名</span>
			</a>
		</nav>


<div class="activity_from_bg discuss_2 discuss_close" style="display: none;"></div>
			<div class="activity_from discuss_from discuss_2" style="display: none;">
				
				<!-- <form action="" method="post" id="discuss_form"> -->
					<div class="list-block">
					<span id="form_query" class="discuss_from_btn discuss_close">确定</span>
					<span class="discuss_from_btn discuss_from_btn2 discuss_close">取消</span>
						<div class="item-title text-center">我要讨论</div>
				    <ul>
				      <!-- Text inputs -->
				      <li>
				        <div class="item-content">
				          <div class="item-inner">
				            <div class="item-input">
				            	<textarea name="content" class="js_discuss_bottom_text" placeholder="我要讨论.."></textarea>
				            </div>
				          </div>
				        </div>
				      </li>
				    </ul>
				  </div>
				  <div class="content-block">
				    <div class="row">
				    </div>
				  </div>
			   <!-- </form> -->
			</div>
{include file="Public:footer" /}
<link rel="stylesheet" href="__PUBLIC__/Home/layer_mobile/need/layer.css" />
<script type="text/javascript" src="__PUBLIC__/Home/layer_mobile/layer.js" ></script>
<script>
var activity_id = {$Think.get.activity_id};
var user_id = {$Think.session.user_id};
//信息框
/* //提示
  layer.open({
    content: 'hello layer'
    ,skin: 'msg'
    ,time: 2 //2秒后自动关闭
  });
   */
$("#info_form").submit(function(){
	var name = $("input[name='name']").val();
	var phone = $("input[name='mobile']").val();
	var email = $("input[name='email']").val();
	var myArray = [
	   		 	{'val':name, 'message':'请输入姓名'},
	   		 	{'val':phone, 'message':'请输入手机号码', 'geshi':'手机格式不正确'},
	   		 	{'val':email, 'message':'请输入邮箱','geshi':'邮箱格式不正确'},
	   		 ];
	var mobile_regular = /(1[3-9]\d{9})$/;  //手机
	var email_regular = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;	//邮箱
	for (var i = 0; i < myArray.length; i++) {
	 	if(i == 1){
	 		if(myArray[i].val == ''){
	 			message(myArray[i].message);
	 		    return false; 
	 		}
	 		if(!mobile_regular.test(myArray[i].val)){ 
	 			message(myArray[i].geshi);
	 		    return false; 
	 		}
	 	}
	 	if(i == 2){
	 		if(myArray[i].val == ''){
	 			message(myArray[i].message);
	 		    return false; 
	 		}
	 		if(!email_regular.test(myArray[i].val)){ 
	 			message(myArray[i].geshi);
	 		    return false; 
	 		}
	 	}
	 	if(myArray[i].val == ''){
	 		message(myArray[i].message);
	 		return false;
	 	}else if(myArray[i].val == 0){
	 		message(myArray[i].message);
	 		return false;
	 	}
	 }
});
   
//底部提示 
 function message(msg){
	  layer.open({
	    content: msg,
	    skin: "footer" ,
	    time: 2 //2秒后自动关闭
	  });
 }  
 
 var reply_user_id = '';
 var reply_nickname = '';
 function discuss_form(user_id, nickname){
 	reply_user_id = user_id;
 	reply_nickname = nickname;
 	var text_placeholder = '';
 	if(reply_nickname){
 	    text_placeholder = '回复'+reply_nickname+'...';
 	}else{
 		text_placeholder = '讨论...'
 	}
 	$(".discuss_2").slideToggle();
 	$("textarea[name='content']").attr('placeholder', text_placeholder);
 }

 $("#form_query").click(function(){
 	var content = $("textarea[name='content']").val();
 	if(content.length <= 0){
 		Zepto.toast('请输入讨论内容', 2000, 'success top');
 	}else if(content.length > 0 && content.length < 100){
 		 $.ajax({
 			type : "POST",
 			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
 			url:"{:U('addDiscuss')}",//+tab,
 			data : {'content':content, 'activity_id':activity_id,'reply_user_id':reply_user_id,'reply_nickname':reply_nickname},// 你的formid 搜索表单 序列化提交
 			dataType : 'html',
 			success: function(data){
 				if(data != false){
 					$("#discuss_ul").prepend(data);
 					Zepto.toast('讨论成功', 2000, 'success top');
 				}else{
 					Zepto.toast('讨论失败!', 2000, 'success top');
 				}
 				$("textarea[name='content']").val('');
 			}
 		});  
 	}
 });
 
 $(".js-bm").click(function() {
	 //是否会员、是否报名人数已满
	   $.ajax({
			type : "GET",
			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
			url:"{:U('isMemberAndisMaxPeople')}",//+tab,
			data : {'user_id':user_id,'activity_id':activity_id},// 你的formid 搜索表单 序列化提交
			dataType : 'json',
			success: function(data){
				if(data.status == 1){
					$(".discuss_1").slideToggle();
				}else if(data.status == 2){
					 Zepto.confirm('抱歉，您还不是会员，立马绑定手机成为正式会员!', '提示', function () {
						 //Zepto.alert('You clicked Ok button');
						 Zepto.showIndicator();
					     setTimeout(function () {
					    	Zepto.hideIndicator();
					     }, 2000);
						 window.location.href="{:U('Index/applyUser')}";
				      });
					/* setTimeout(function(){								
						 window.location.href="http://www.baidu.com";	
					   },2000); */
				}else if(data.status == 3){
					//Zepto.toast(''+data.message+'', 2000, 'success top');
					Zepto.alert(''+data.message+'');
					return false;
				}
			}
		});  
	})
	
/* 	function follow(obj){
		var _this = $(obj);
		 $.ajax({
				type : "GET",
				//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
				url:"{:U('collectActivity')}",//+tab,
				data : {'user_id':user_id,'activity_id':activity_id},// 你的formid 搜索表单 序列化提交
				dataType : 'json',
				success: function(data){
					if(data.status == 1){
						_this.find('.tab-label').text('已关注');
						_this.removeAttr('onclick');
						Zepto.toast(''+data.message+'', 2000, 'success top');
					}else if(data.status == 2){
						Zepto.toast(''+data.message+'', 2000, 'success top');
					}
				}
			});  
 	} */
 	
 //one只执行一次
 $("#follow").one('click',function(){
	 var _this = $(this);
	 $.ajax({
			type : "GET",
			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
			url:"{:U('collectActivity')}",//+tab,
			data : {'user_id':user_id,'activity_id':activity_id},// 你的formid 搜索表单 序列化提交
			dataType : 'json',
			success: function(data){
				if(data.status == 1){
					_this.find('.tab-label').text('已关注');
					//Zepto.toast(''+data.message+'', 2000, 'success top');
					Zepto.alert(''+data.message+'');
				}else if(data.status == 2){
					Zepto.alert(''+data.message+'');
					//Zepto.toast(''+data.message+'', 2000, 'success top');
				}
			}
		});  
 });
	
 
</script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>

<script>
  /*
   * 注意：
   * 1. 所有的JS接口只能在公众号绑定的域名下调用，公众号开发者需要先登录微信公众平台进入“公众号设置”的“功能设置”里填写“JS接口安全域名”。
   * 2. 如果发现在 Android 不能分享自定义内容，请到官网下载最新的包覆盖安装，Android 自定义分享接口需升级至 6.0.2.58 版本及以上。
   * 3. 完整 JS-SDK 文档地址：http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html
   *
   * 如有问题请通过以下渠道反馈：
   * 邮箱地址：weixin-open@qq.com
   * 邮件主题：【微信JS-SDK反馈】具体问题
   * 邮件内容说明：用简明的语言描述问题所在，并交代清楚遇到该问题的场景，可附上截屏图片，微信团队会尽快处理你的反馈。
   */
  wx.config({
    appId: '{$signPackage["appId"]}',
    timestamp: {$signPackage["timestamp"]},
    nonceStr: '{$signPackage["nonceStr"]}',
    signature: '{$signPackage["signature"]}',
    jsApiList: [
        'checkJsApi',
        'onMenuShareTimeline',
        'onMenuShareAppMessage',
        'onMenuShareQQ',
        'onMenuShareWeibo',
        'hideMenuItems',
        'showMenuItems',
        'hideAllNonBaseMenuItem',
        'showAllNonBaseMenuItem',
        'translateVoice',
        'startRecord',
        'stopRecord',
        'onRecordEnd',
        'playVoice',
        'pauseVoice',
        'stopVoice',
        'uploadVoice',
        'downloadVoice',
        'chooseImage',
        'previewImage',
        'uploadImage',
        'downloadImage',
        'getNetworkType',
        'openLocation',
        'getLocation',
        'hideOptionMenu',
        'showOptionMenu',
        'closeWindow',
        'scanQRCode',
        'chooseWXPay',
        'openProductSpecificView',
        'addCard',
        'chooseCard',
        'openCard'
      ]
  });
 
</script>


  <!--微信分享-->
  <script type="text/javascript">
  var server_url = "{$Think.server.http_host}";
  var activity_id = {$activity['id']};
  wx.ready(function () {
  var shareData = {
	  title: '广东国防教育学会活动',
	  desc: '{$activity['activity_name']}',
	  link: server_url+'/ActivityDetail/index/activity_id/{$activity['id']}',
	  imgUrl: server_url+'{$activity['activity_img']}',
	  trigger:function(res){
	  	alert('用户点击发送');
	  },
	  success: function (res) {
          $.ajax({
                url : "{:U('share')}",
                data : {'id':activity_id},
                type : 'get',
                dataType : 'json',
                async : false,   //取消同步，执行完之后再往下执行
                success : function(data){
                    if(data.status == 1){
                    	Zepto.alert(''+data.message+'');
                    	//message(data.message);
                      /*layer.msg(''+data.message+'',{time:1000});
                       setTimeout(function(){               
                        window.location.href="__URL__/yaoyiyao";  
                       },2000); */
				               //window.location.href="__URL__/yaoyiyao";//yaoyiyao	
                    }else if(data.status == 2){
                    	Zepto.alert(''+data.message+'');
                    	//message(data.message);
                      //alert(data.message);
                      //layer.msg(''+data.message+'',{time:1000});
                    }
                }
            });
      },
      cancel: function (res) {
        //alert('已取消');
      },
      fail: function (res) {
        alert(JSON.stringify(res));
      }
  };
  wx.onMenuShareAppMessage(shareData);
  wx.onMenuShareTimeline(shareData);
  wx.onMenuShareQQ(shareData);
  wx.onMenuShareWeibo(shareData);
  });
  wx.error(function (res) {
  	console.log(res.errMsg);
  });
  </script>
  <!--END 微信分享-->

